﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace FrmHotel
{
    public partial class FrmUpdateLieXing : Form
    {
        public FrmUpdateLieXing()
        {
            InitializeComponent();
        }
        public int id;//接收类型编号
        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void FrmUpdateLieXing_Load(object sender, EventArgs e)
        {
            Sata();
        }
        public void Sata()
        {
            string sql = string.Format("select ClassName from CommodityClass where ClassId={0}", id);
            SqlDataReader r=DBHelper.SelectMore(sql);
            if (r.Read())
	        {
		        this.textBox1.Text=r["ClassName"].ToString();
	        }
            r.Close();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            string name=this.textBox1.Text;
            string sql = string.Format("update CommodityClass set ClassName='{0}' where ClassId={1}", name, id);
            int r=DBHelper.ExecuteUpdate(sql);
            if (r>0)
	        {
		  MessageBox.Show("修改成功！","提示信息！");
                return;
	        }
            else
	            {
                 MessageBox.Show("修改失败！","提示信息！");
                return;
	        }
        }
       
    }
}
